<?php
/**
 * Created by PhpStorm.
 * User: Antique
 * Date: 2021/12/11
 * Time: 下午 05:40
 */

namespace test\primary;

include 'set_session.php';

class mate_cookie
{
function mate(){
    $set_session = new set_session();
    $Token = $_COOKIE['Token'];
    $pd=0;
    $arr = $set_session->select_session($Token);
    $life = $arr['life'];

    switch (true) {
        case empty($Token) :
            //未设置cookie
            $pd = 1;
            break;
        case empty($arr):
            //cookie匹配失败
            $pd = 2;
            break;
        case time() > $life;
            $pd = 3;
            break;
    }
    return $pd;
}
}